<html>
<!-- Specify group columns in Meta.group attrbute and define style for group row -->
<style>
 {{{defaultstyle}}}
 body {margin: 20px 20px}
 table {width: 90%; box-shadow: 5 5 10 #777;}
 td, th {border: solid #eee 1px; font-size: 12px; padding: 2 2; }
 th {background: #888; color: white; padding: 5px 5px; resize: horizontal; draggable: true;}
 .total {background: #888; color: white}
 .group {background: #ffffee; color: navy; font-weight: bold; }
 .group td {font-size: 16px; padding-top: 5px; }
</style>

<h2>Orders by Customers</h2>


<DATAPACKET>
<METADATA group="COMPANY">
 <FIELDS>
  <FIELD name="ORDERNO" caption="Order No" align="center" group_template="@COMPANY@" total="count(*)"/>
  <FIELD name="SALEDATE" caption="Sale Date"/>
  <FIELD name="SHIPDATE" caption="Ship Date"/>
  <FIELD name="LASTNAME" caption="Employee" />
  <FIELD name="PAYMENTMETHOD" caption="Payment Method" align="center"/>
  <FIELD name="ITEMSTOTAL" caption="Total"  total="sum" format="# ### ###.00" />
  <FIELD name="AMOUNTPAID" caption="Amount Paid" total="sum" format="# ### ###.00"/>
 </FIELDS>
 <SQL>
  select c.company, o.orderno, cast(saledate as date) saledate, cast(shipdate as date) shipdate,
   paymentmethod, itemstotal, amountpaid, e.lastname
  from customer c join orders o on o.custno=c.custno
  join employee e on e.empno=o.empno
  order by 1
  </SQL>
 </METADATA>
</DATAPACKET>

</html>
